package pattern.iterator;

import java.util.Iterator;

public class Client {
    
    public static void main(String[] args) {
        StudentAggregate studentAggregate = new StudentAggregateImpl();
        studentAggregate.addStudent(new Student("aa",1));
        studentAggregate.addStudent(new Student("bb",2));
        studentAggregate.addStudent(new Student("cc",3));
        studentAggregate.addStudent(new Student("ee",4));

        StudentIterator studentIterator = studentAggregate.getStudentIterator();
        while (studentIterator.hasNext()){
            Student next = studentIterator.next();
            System.out.println(next);
        }
    }
}
